﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:PSE.Framework.UI.Controls.SmartClient;assembly=PSE.Framework.UI.Controls">

    <!--BEGIN POPUP-->
    <Style TargetType="{x:Type Controls:Popup}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:Popup}">
                    <Grid>
                        <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{DynamicResource BrushPopupShadow}" CornerRadius="6" Margin="3.5,3.5,0,0"/>
                        <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{DynamicResource BrushPopupBackground}" BorderThickness="1" CornerRadius="6" Margin="0,0,4.5,4.5"/>
                        <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" CornerRadius="6" Margin="0,0,3.5,3.5">
                            <Grid HorizontalAlignment="Stretch">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="22"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid Grid.Row="0" HorizontalAlignment="Stretch">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="30"/>
                                    </Grid.ColumnDefinitions>
                                    <Border Grid.ColumnSpan="2" Background="{DynamicResource BrushPopupHeaderBackground}" CornerRadius="6,6,0,0"/>
                                    <Label Grid.Column="0" Padding="0" Content="{TemplateBinding Header}" Height="22" HorizontalContentAlignment="Left" Foreground="{DynamicResource BrushPopupHeaderForeground}" Margin="10,4,0,0" Style="{DynamicResource ControlFont}"/>
                                    <Controls:Button Grid.Column="1" HorizontalContentAlignment="Right" Style="{DynamicResource ControlButtonMessageBoxClose}" Command="Controls:PopupCommands.Close"/>
                                </Grid>

                                <Border Grid.Row="1" BorderBrush="{DynamicResource BrushPopupBorder}" CornerRadius="0,0,6,6" BorderThickness="1,0,1,1">
                                    <Controls:ScrollViewer VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="{Binding Height, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:Popup}}}" Width="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
                                        <ContentPresenter Margin="7" Height="Auto" Width="Auto"/>
                                    </Controls:ScrollViewer>
                                </Border>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--END POPUP-->
</ResourceDictionary>